package dbx

import (
	"time"

	"gitee.com/chunanyong/zorm"
	"github.com/jinzhu/copier"
)

type CommonEntity struct {
	zorm.EntityStruct

	Id        int64     `column:"id"`         // 主健
	CreatedAt time.Time `column:"created_at"` // 创建时间
	CreatedBy int64     `column:"created_by"` // 创建人
	UpdatedAt time.Time `column:"updated_at"` // 更新时间
	UpdatedBy int64     `column:"updated_by"` // 更新人
	DeletedAt time.Time `column:"deleted_at"` // 删除时间
	DeletedBy int64     `column:"deleted_by"` // 删除人
}

func (entity *CommonEntity) ToModel(modelPtr any) error {
	return copier.Copy(modelPtr, entity)
}

func (entity *CommonEntity) FromModel(modelPtr any) error {
	return copier.Copy(entity, modelPtr)
}
